﻿#region Copyright ©2008-2009, Technische Universitaet Muenchen
// ====================================================================================================
//
// Last Changed by       $Author: kalus $
// Last Changed Date     $LastChangedDate: 2009-03-18 16:42:33 +0100 (Wed, 18 Mar 2009) $
// Last Changed Revision $Rev: 36 $
//
// ====================================================================================================
#endregion

using System.Collections.Generic;
using System.Xml;

namespace Tum.CollabXT.SPEM
{
    public class Role : IRole
    {
        #region Private Members
        private string _Id;
        private string _Name;
        private string _Description;
        private Dictionary<string, object> _ExtendedData = new Dictionary<string, object>();

        private string _Profile;
        private string _Staffing;
        #endregion

        public Role() { }
        public Role(XmlNode node) 
        {
            _Id = node.Attributes["id"].Value;
            _Name = node.Attributes["name"].Value;
            _Description = node.Attributes["briefDescription"].Value;
            
            XmlNode profileNode = node.SelectSingleNode("Presentation/MainDescription");
            if(profileNode == null) {
                _Profile = "";
            } else {
                _Profile = profileNode.InnerText;
            }

            XmlNode staffingNode = node.SelectSingleNode("Presentation/Skills");
            if (staffingNode == null)
            {
                _Staffing = "";
            }
            else
            {
                _Staffing = staffingNode.InnerText;
            }
        }

        #region IRole Members

        public string Profile
        {
            get { return (_Profile); }
            set { _Profile = value; }
        }

        public string Staffing
        {
            get { return (_Staffing); }
            set { _Staffing = value; }
        }

        #endregion

        #region IProcessElement Members

        public string Id
        {
            get { return (_Id); }
            set { _Id = value; }
        }

        public string Name
        {
            get { return (_Name); }
            set { _Name = value; }
        }

        public string Description
        {
            get { return (_Description); }
            set { _Description = value; }
        }

        public Dictionary<string, object> ExtendedData
        {
            get { return _ExtendedData; }
        }

        #endregion
    }
}
